from functools import reduce
class Solution:
    def generate(self, numRows):
        """
        :type numRows: int
        :rtype: List[List[int]]
        """
        if numRows == 0:
            return []
        res = [[1]]
        for i in range(numRows - 1):
            lastrow = res[-1][:]
            lastrow.insert(0, 0)
            lastrow.append(0)

            row = []
            for j in range(1, len(lastrow)):
                row.append(lastrow[j - 1] + lastrow[j])
            res.append(row)
        

        return res

s = Solution()
print('ss', s.generate(5))

